Imports System.Data.SqlClient

Friend Class DBServer_Factory
    Inherits DBBase

    Public Function AllServers() As ArrayList
        Dim oList As New ArrayList

        Dim sSQL As String = "select"
        sSQL = sSQL & "     a.[ID]"
        sSQL = sSQL & " from"
        sSQL = sSQL & "     tDDServers a"
        sSQL = sSQL & " where"
        sSQL = sSQL & "     [IsDeleted]=0"
        sSQL = sSQL & " order by"
        sSQL = sSQL & "     [name]"

        Dim oData As DataTable = MyBase.ExecuteReadToDataTable(sSQL)

        For Each oRow As DataRow In oData.Rows
            Dim oObject As New Server(oRow.Item(0))
            oObject.Load()

            oList.Add(oObject)
        Next

        oData.Dispose()

        Return oList
    End Function

    Public Function AllActiveServers() As ArrayList
        Dim oList As New ArrayList

        Dim sSQL As String = "select"
        sSQL = sSQL & "     a.[ID]"
        sSQL = sSQL & " from"
        sSQL = sSQL & "     tDDServers a"
        sSQL = sSQL & " where"
        sSQL = sSQL & "     [IsActive]=1"
        sSQL = sSQL & "     and [IsDeleted]=0"
        sSQL = sSQL & " order by"
        sSQL = sSQL & "     [name]"

        Dim oData As DataTable = MyBase.ExecuteReadToDataTable(sSQL)

        For Each oRow As DataRow In oData.Rows
            Dim oObject As New Server(oRow.Item(0))
            oObject.Load()

            oList.Add(oObject)
        Next

        oData.Dispose()

        Return oList
    End Function
End Class
